

function deleteImg(delBtn){

		$(delBtn).parents("li").prev().remove();
		//移除下一个li节点
		$(delBtn).parents("li").remove();
		
	
}
function updateFood(pn,id) {
		var fileInput = $('#upload').get(0).files[0]
		
	if(fileInput){
		$.ajax({
		url: "foodManage?method=updateFood?food_id="+id,
		type: 'POST',
		cache: false, //不缓存
		data: new FormData($('#filesForm')[0]), //将整个表单的数据封装到FormData对象中
		processData: false, //传输的数据是文件
		contentType: false, //false代表文件上传
		dataType: "json",
		beforeSend: function() {
			lightyear.loading('show');
		},
		success: function(data) {
			resultAlert(data.code, "增加");
			if(data.code == 1){
				setTimeout(function() {
					window.location.href = "foodmanage.html?pn="+pn;
				}, 2000);
			}
		}
		
	});
		
		
	}else{
		lightyear.loading('show');
		setTimeout(function() {
			lightyear.loading('hide');
			lightyear.notify('您还未添加图片', 'danger', 1000, 'mdi mdi-close-circle');
		}, 1000);
	}
	
}



